<template>
	<!-- 图片组件 -->
	<view class="grid-pic" @click="onDelete">
		<u-image class="pic-img" :class="{'add-icon':picType==1}" width="150rpx" height="150rpx" :src="imgSrc"></u-image>
		<u-icon class="pic-del" v-if="picType==0" name="close-circle-fill"></u-icon>
	</view>
</template>

<script>
	export default{
		data(){
			return{}
		},
		data:{
		},
		props:{
			imgSrc:{
				type:String,
				default:''
			},
			picType:{
				type:Number,
				default:0
			}
		},
		methods:{
			onDelete(){
				if(this.picType==0){
					
					this.$emit('deleteImg',this.imgSrc)
					
				}else{
					this.$emit('addImg')
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.grid-pic{
		display: flex;
		flex-direction: row;
		padding: 20rpx;
		width: 200rpx;
		height: 200rpx;
		.pic-del{
			position: relative;
			right: 20rpx;
			top: -90rpx;
		}
		.add-icon{
			background: #f5f5f5;
		}
	}
</style>
